package Decorator;

import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

public abstract class DecoratorAnimated extends Decorator {
	private BufferedImage _imageStatic;
	private boolean _isAnnimated;
	private Image _imageAnnimate;
	
	public DecoratorAnimated(JPanel pan, Item p_item, File p_file) {
		super(pan, p_item);

		// Not Annimate in all case when create 
		_isAnnimated = false;
		

        try {
        	_imageStatic = ImageIO.read(p_file);
    		_imageAnnimate = new ImageIcon(p_file.getAbsolutePath()).getImage();
	    } catch (IOException e) {
	            e.printStackTrace();
	    }
	}
	
	public void stopAnnimation()
	{
		_isAnnimated = false;
	}
	
	public void startAnnimation()
	{
		_isAnnimated = true;
	}
	
	protected boolean getIsAnnimated()
	{
		return _isAnnimated;
	}
	
	protected Image getAnnimateImage()
	{
		return _imageAnnimate;
	}
	
	protected Image getStaticImage()
	{
		return _imageStatic;
	}

}
